package ca.tatham.senssim.pddd;

import ca.tatham.senssim.AbstractPacket;
import ca.tatham.senssim.diffusion.DataMessage;
import ca.tatham.senssim.util.Address;

public class AcknowledgementMessage extends AbstractPacket
{
  private final Address m_dataSource;
  private final long m_dataSequence;

  public AcknowledgementMessage(Address source, DataMessage data)
  {
    super(source, data.getSource(), null);
    m_dataSource = data.getOriginalSource();
    m_dataSequence = data.getSequence();
  }

  public long getDataSequence()
  {
    return m_dataSequence;
  }

  public Address getDataSource()
  {
    return m_dataSource;
  }

  public int getSize()
  {
    return 16;
  }

  @Override
  public String toString()
  {
    return "Ack for #" + getDataSequence() + " from " + getDataSource();
  }
}
